import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_jd/pages/launch/controller.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:get/route_manager.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

// 启动页
class LaunchPage extends GetView<LaunchController> {
  @override
  Widget build(BuildContext context) {
    final LaunchController controller = Get.put(LaunchController());

    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle.light,
      child: Scaffold(
        body: Stack(
          alignment: Alignment(1.0, -1.0), // 右上角对齐
          children: [
            ConstrainedBox(
              constraints: BoxConstraints.expand(),
              child: Image.asset(
                'assets/images/launch/ad.jpg',
                fit: BoxFit.fill,
              ),
            ),
            Positioned(
              bottom: 40.h,
              right: 20.w,
              // ignore: deprecated_member_use
              child: FlatButton(
                minWidth: 80.w,
                height: 34.h,
                padding: EdgeInsets.only(bottom: 2.h),
                color: Color.fromRGBO(0, 0, 0, 0.3),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(20.r),
                ),
                child: Obx(
                  () => Text(
                    "${controller.count} 跳过",
                    style: TextStyle(color: Colors.white, fontSize: 13.0.sp),
                  ),
                ),
                onPressed: () {
                  controller.toHomePage();
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}
